package com.dingli.DAO;

import com.dingli.utils.DataSourceUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public class RoleLevelDAO {
    private QueryRunner runner = new QueryRunner(DataSourceUtil.getDataSource());

    public List<Map<String, Object>> getRole(){
        String sql = "select * from Role";
        try {
            List<Map<String, Object>> results = runner.query(sql, new MapListHandler());
            return results;

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


    public List<Map<String, Object>> getTicketLevel(){
        String sql = "select * from ticketLevel";
        try {
            List<Map<String, Object>> results = runner.query(sql, new MapListHandler());
            return results;

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
